package com.rongc.client.freight.business.supply.model;

import android.content.Context;
import android.os.Bundle;

import com.rongc.client.core.utils.ActivityUtils;
import com.rongc.client.freight.business.supply.view.activity.SupplyWaybillActivity;
import com.rongc.client.freight.business.supply.view.activity.SupplyWaybillDetailActivity;
import com.rongc.client.freight.business.waybill.model.WayBillBean;
import com.rongc.client.freight.business.waybill.view.activity.WayBillNewActivity;

import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.CANEL_CZ_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.CANEL_HZ_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.COMPLATE_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.DQR_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.DTH_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.DZF_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.PDZ_TYPE;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.ROAD_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.SH_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.YAJIN_STATUS;

/**
 * Created by ccqx on 2017/6/28.
 */

public class SupplyDic {

    /**
     * 返回值类型
     */
    public final static class ResultType {
        /** 车型 */
        public static final int Model_TYPE = 10;
        /** 车长 */
        public static final int Length_TYPE = 11;
        /** 出发地 */
        public static final int DEPARTURE_TYPE = 12;
        /** 目的地 */
        public static final int DESTINATION_TYPE = 13;
        /** 留言 */
        public static final int MESSAGE_TYPE = 14;
    }

    /**
     * 运单状态
     */
    public final static class StatusType {

//        货主方：派单中  待支付   待提货   运单中    确认收货   完成      取消
//        司机方：接单中  待货主支付  确定提货   运单中  确认货到   完成   取消


//        1派单中(接单中) ，2等待货主确认,3.未支付(待货主支付),4.等待提货，5.运单中,6车主确认收货待评价，7完成，8车主取消，9 货主取消 10 货主确认到货
        /** 派单中（接单中） */
        public static final int PDZ_TYPE = 1;
        /** 等待货主确认 */
        public static final int DQR_STATUS = 2;
        /** 待支付 */
        public static final int DZF_STATUS = 3;
        /** 待提货 */
        public static final int DTH_STATUS = 4;
        /** 运单中 */
        public static final int ROAD_STATUS = 5;
        /** 确认收货 */
        public static final int SH_STATUS = 6;
        /** 完成 */
        public static final int COMPLATE_STATUS = 10;
        /** 车主取消 */
        public static final int CANEL_CZ_STATUS = 8;
        /** 货主取消 */
        public static final int CANEL_HZ_STATUS = 9;
        /** 待车主交押金 */
        public static final int YAJIN_STATUS = 14;

    }

    public static void jumpActivity(Context context,int status, WayBillBean data){
        switch (status){
            case PDZ_TYPE:
                Bundle bundle = new Bundle();
                bundle.putString("data",data.getGid());
                ActivityUtils.startActivity(context,SupplyWaybillActivity.class,bundle);
                break;
            case DQR_STATUS:
                bundle = new Bundle();
                bundle.putSerializable("data",data);
                ActivityUtils.startActivity(context,SupplyWaybillDetailActivity.class,bundle);
                break;
            case DZF_STATUS:
            case YAJIN_STATUS:
            case DTH_STATUS:
            case ROAD_STATUS:
            case SH_STATUS:
            case COMPLATE_STATUS:
            case CANEL_CZ_STATUS:
            case CANEL_HZ_STATUS:
                bundle = new Bundle();
                bundle.putString("data",data.getOrderid());
                bundle.putInt("status",status);
                ActivityUtils.startActivity(context,WayBillNewActivity.class,bundle);
//                ActivityUtils.toast("jump waybill");
                break;
        }
    }

    public static int getNextStatus(int status){
        switch (status){
            case PDZ_TYPE:
            case DQR_STATUS:
            case DZF_STATUS:
                return YAJIN_STATUS;
            case YAJIN_STATUS:
                return DTH_STATUS;
            case DTH_STATUS:
                return ROAD_STATUS;
            case ROAD_STATUS:
                return SH_STATUS;
            case SH_STATUS:
                return COMPLATE_STATUS;
            case COMPLATE_STATUS:
                return CANEL_HZ_STATUS;
            default:
                return CANEL_HZ_STATUS;
        }
    }

    public static String getStatusTitle(int status){
        String statusStr = "";
        switch (status){
            case PDZ_TYPE:
            case DQR_STATUS:
            case DZF_STATUS:
                statusStr = "派单中";
                break;
            case YAJIN_STATUS:
            case DTH_STATUS:
            case ROAD_STATUS:
            case SH_STATUS:
                statusStr = "运单中";
                break;
            case COMPLATE_STATUS:
            case CANEL_CZ_STATUS:
            case CANEL_HZ_STATUS:
                statusStr = "运单详情";
                break;
        }
        return statusStr;
    }

    public static String getStatusStr(int status){
        String statusStr = "";
        switch (status){
            case PDZ_TYPE:
                statusStr = "派单中";
                break;
            case DQR_STATUS:
                statusStr = "待确认司机";
                break;
            case DZF_STATUS:
                statusStr = "待支付";
                break;
            case YAJIN_STATUS:
                statusStr = "待司机交押金";
                break;
            case DTH_STATUS:
                statusStr = "待提货";
                break;
            case ROAD_STATUS:
                statusStr = "运单中";
                break;
            case SH_STATUS:
                statusStr = "待收货";
                break;
            case COMPLATE_STATUS:
                statusStr = "已完成";
                break;
            case CANEL_CZ_STATUS:
                statusStr = "取消";
                break;
            case CANEL_HZ_STATUS:
                statusStr = "取消";
                break;
            default:
                statusStr = "运单详情";
                break;
        }

        return statusStr;
    }

    public static String getStatusBtn(int status){
        String statusStr = "";
        switch (status){
            case PDZ_TYPE:
                statusStr = "联系车主";
                break;
            case DQR_STATUS:
                statusStr = "确认司机";
                break;
            case DZF_STATUS:
                statusStr = "前往支付运费到平台";
                break;
            case YAJIN_STATUS:
//                statusStr = "押金";
                break;
            case DTH_STATUS:
//                statusStr = "待提货";
                break;
            case ROAD_STATUS:
//                statusStr = "运单中";
                break;
            case SH_STATUS:
                statusStr = "确认收货";
                break;
            case COMPLATE_STATUS:
                statusStr = "评论";
                break;
            case CANEL_CZ_STATUS:
//                statusStr = "取消";
                break;
            case CANEL_HZ_STATUS:
//                statusStr = "取消";
                break;
        }

        return statusStr;
    }


    public static boolean getStatusEnable(int status){
        boolean con = false;
        switch (status){
            case PDZ_TYPE:
            case DQR_STATUS:
                con = true;
                break;
            case DZF_STATUS:
            case YAJIN_STATUS:
            case DTH_STATUS:
            case ROAD_STATUS:
            case SH_STATUS:
            case COMPLATE_STATUS:
            case CANEL_CZ_STATUS:
            case CANEL_HZ_STATUS:
                con = false;
                break;
        }

        return con;
    }
}
